<%-- 
    Document   : userGroupManager
    Created on : 2009-4-13, 20:05:29
    Author     : 47
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
        ljsystem.UserGroupManager mgr = new ljsystem.UserGroupManager();
        java.util.Iterator itr = mgr.getAllGroup().iterator();
        bo.UserGroup g;
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <%@include file="/main/head.jspf" %>
        <title>管理用户组</title>
        <script language="javascript">
            function selectAll(flag){
                var cbxArray=new Array();
                cbxArray=document.getElementsByName("groupid");
                var i=0;
                for(i=0;i<cbxArray.length;i++){
                    cbxArray[i].checked=flag;
                }
                return false;
            }
            function deleteselected(){
                var r=confirm("你确定删除选中的用户组吗？");
                if(r){
                    document.getElementById("myform").submit();
                }
                return false;
            }
            function deleteaction(gname,gid){
                var r=confirm("你确定删除用户组“"+gname+"”吗？");
                if(r){
                    window.location="delGroupdo.jsp?groupid="+gid;
                }
                return false;
            }
        </script>
    </head>
    <body>
        <%@include file="/main/bodyhead.jspf" %>
        <table align="center" border="1" cellpadding="0" cellspacing="0" width="100%">
            <tr>
                <td style="text-align:left;border-right:none;">
                    <a href="userManager.jsp">返回用户管理</a>
                </td>
                <td style="text-align:right;">
                    <a href="addGroup.jsp">添加新组</a>
                    <a href="#" onclick="return selectAll(true)">全选</a>
                    <a href="#" onclick="return selectAll(false)">全不选</a>
                    <a href="#" onclick="return deleteselected()">删除</a>
                </td>
            </tr>
        </table>
        <br>
        <table align="center" border="1" cellpadding="2" cellspacing="0" width="600px"><tr><td>
                    <table align="center" border="1" cellpadding="0" cellspacing="0" width="800px">
                        <form id="myform" action="delGroupdo.jsp" method="post">
                            <th colspan="3" class="maintitle">所有用户组</th>
                            <%
        while (itr.hasNext()) {
            g = (bo.UserGroup) itr.next();
                            %>
                            <tr class="infoline">
                                <td style="text-align:left;">
                                    <input type="checkbox" name="groupid" value="<%=g.groupId%>">
                                    <%=g.groupName%>
                                </td>
                                <td style="text-align:left;"><%=g.memo%></td>
                                <td style="text-align:right;">
                                    <a href="editGroup.jsp?groupid=<%=g.groupId%>">编辑</a>
                                    <a href="#">组员</a>
                                    <a href="#">权限</a>
                                    <a href="#" onclick="return deleteaction('<%=g.groupName%>','<%=g.groupId%>')">删除</a>
                                </td>
                            </tr>
                            <%}%>
                            <tr class="maintitle">
                                <td colspan="3">&nbsp;</td>
                            </tr>
                        </form>
                    </table>
        </td></tr></table>
    </body>
</html>
